########################################################################
# PLACE LIST CREATIONS HERE #
########################################################################
stage_list = ["moon", "mars", "jupiter", "pluto", "space", "city"]
########################################################################
# PLACE ALL OTHER CODE BELOW THIS #
########################################################################
stage_image = stage_list[1]
stage.set_background(stage_image)
t = codesters.Teacher()
stages = t.find_text('head_list')
comments = t.find_text('ALL OTHER', True)
try:
tval0 = int(comments[0][0])
except:
tval0 = 0.0
try:
tval1 = head_list
tval2 = len(head_list)
tval3 = stages[0][1].count(',')
tval4 = int(stages[0][0])
except:
tval1 = "DNE"
tval2 = "DNE"
tval3 = "DNE"
tval4 = 0.0
t1 = TestObjective()
t1.add_success('head1' in tval1 and 'head2' in tval1 and 'head3' in tval1 and 'head4' in tval1 and 'head5' in tval1 and 'head6' in tval1 and tval2 == 6 and tval4 < tval0, "Great job!")
t1.add_failure(type(tval0) == float, "Don't delete the comments!")
t1.add_failure(tval1 == "DNE", "Did you create a list named head_list?")
t1.add_failure(tval0 < tval4, "Make sure to place the list in the first section of the code!")
t1.add_failure(tval2 == 3, "Did you add three more values to the list?")
t1.add_failure(tval2 < 6, "Oops! Make sure your list has six values in it, all separated by commas.")
t1.add_failure(tval2 > 6, "Did you add extra values to your list?")
t1.add_failure(tval3 < 5, "Make sure all the values in your list are separated by commas.")
t1.add_failure('cat' in tval1 or 'dog' in tval1 or 'pig' in tval1, "Did you change the three values in the original list?")
t1.add_failure(tval1 != ["head1", "head2", "head3", "head4", "head5", "head6"], "Are all the values in your head_list correct?")
tester = TestManager()
tester.add_test_list([t1])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)